/*
 * @Author: 半生瓜 1515706227@qq.com
 * @Date: 2024-05-07 10:39:27
 * @LastEditors: 半生瓜 1515706227@qq.com
 * @LastEditTime: 2024-05-15 10:11:30
 * @FilePath: \vue-element-plus-admin-mini\src\api\table\index.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import request from '@/axios'
import type { TableData } from './types'

export const getTableListApi = (params: any) => {
  return request.get({ url: '/mock/example/list', params })
}

export const getCardTableListApi = (params: any) => {
  return request.get({ url: '/mock/card/list', params })
}

export const getTreeTableListApi = (params: any) => {
  return request.get({ url: '/mock/example/treeList', params })
}

//查询全部产品配置参数接口
export const getSystem = () => {
  return request.post({ url: '/config/manage/all' })
}
//查询活动公告接口
export const getBulletin = () => {
  return request.post({ url: '/bulletin/manage/all' })
}
//保存活动公告接口
export const saveBulletin = (params) => {
  return request.post({ url: '/bulletin/manage/save', data: params })
}

//模板上传接口
export const upTemplate = (params: any) => {
  return request.post({ url: '/zone/template/uploadTemplateZip', params })
}

//保存系统设置接口
export const saveSystem = (params: any) => {
  return request.post({ url: '/config/manage/update', data: params })
}
//删除活动公告
export const deleteBulletin = (params: any) => {
  return request.post({ url: '/bulletin/manage/delete', params })
}

export const saveTableApi = (data: Partial<TableData>): Promise<IResponse> => {
  return request.post({ url: '/mock/example/save', data })
}

export const getTableDetApi = (id: string): Promise<IResponse<TableData>> => {
  return request.get({ url: '/mock/example/detail', params: { id } })
}

export const delTableListApi = (ids: string[] | number[]): Promise<IResponse> => {
  return request.post({ url: '/mock/example/delete', data: { ids } })
}
